package com.shiroexploit.util;

public class RememberMeCache {
    private static RememberMeCache rememberMeCache;

//            case "SpringEcho1":
//            case "SpringEcho2":
//            case "TomcatEcho":
//            case "TomcatEcho2":
//            case "JBossEcho":
//            case "WeblogicEcho":
//            case "ResinEcho":
//            case "JettyEcho":
//            case "AutoFindRequestEcho":

    private String SpringEcho1Cache;
    private String SpringEcho2Cache;
    private String TomcatEchoCache;
    private String TomcatEcho2Cache;
    private String JBossEchoCache;
    private String WeblogicEchoCache;
    private String ResinEchoCache;
    private String JettyEchoCache;
    private String AutoFindRequestEchoCache;

    private RememberMeCache(){

    }

    public static RememberMeCache getInstance(){
        if(rememberMeCache == null){
            rememberMeCache = new RememberMeCache();
        }

        return rememberMeCache;
    }

    public String getSpringEcho1Cache() {
        return SpringEcho1Cache;
    }

    public void setSpringEcho1Cache(String springEcho1Cache) {
        SpringEcho1Cache = springEcho1Cache;
    }

    public String getSpringEcho2Cache() {
        return SpringEcho2Cache;
    }

    public void setSpringEcho2Cache(String springEcho2Cache) {
        SpringEcho2Cache = springEcho2Cache;
    }

    public String getTomcatEchoCache() {
        return TomcatEchoCache;
    }

    public void setTomcatEchoCache(String tomcatEchoCache) {
        TomcatEchoCache = tomcatEchoCache;
    }

    public String getTomcatEcho2Cache() {
        return TomcatEcho2Cache;
    }

    public void setTomcatEcho2Cache(String tomcatEcho2Cache) {
        TomcatEcho2Cache = tomcatEcho2Cache;
    }

    public String getJBossEchoCache() {
        return JBossEchoCache;
    }

    public void setJBossEchoCache(String JBossEchoCache) {
        this.JBossEchoCache = JBossEchoCache;
    }

    public String getWeblogicEchoCache() {
        return WeblogicEchoCache;
    }

    public void setWeblogicEchoCache(String weblogicEchoCache) {
        WeblogicEchoCache = weblogicEchoCache;
    }

    public String getResinEchoCache() {
        return ResinEchoCache;
    }

    public void setResinEchoCache(String resinEchoCache) {
        ResinEchoCache = resinEchoCache;
    }

    public String getJettyEchoCache() {
        return JettyEchoCache;
    }

    public void setJettyEchoCache(String jettyEchoCache) {
        JettyEchoCache = jettyEchoCache;
    }

    public String getAutoFindRequestEchoCache() {
        return AutoFindRequestEchoCache;
    }

    public void setAutoFindRequestEchoCache(String autoFindRequestEchoCache) {
        AutoFindRequestEchoCache = autoFindRequestEchoCache;
    }

    public void setRememberMe(EchoType echoType, String rememberMeCookie){
        if(echoType.getName().equals("SpringEcho1")){
            setSpringEcho1Cache(rememberMeCookie);
        }else if(echoType.getName().equals("SpringEcho2")){
            setSpringEcho2Cache(rememberMeCookie);
        }else if(echoType.getName().equals("TomcatEcho")) {
            setTomcatEchoCache(rememberMeCookie);
        }else if(echoType.getName().equals("TomcatEcho2")){
                setTomcatEcho2Cache(rememberMeCookie);
        }else if(echoType.getName().equals("JBossEcho")){
            setJBossEchoCache(rememberMeCookie);
        }else if(echoType.getName().equals("WeblogicEcho")){
            setWeblogicEchoCache(rememberMeCookie);
        }else if(echoType.getName().equals("ResinEcho")){
            setResinEchoCache(rememberMeCookie);
        }else if(echoType.getName().equals("JettyEcho")){
            setJettyEchoCache(rememberMeCookie);
        }else if(echoType.getName().equals("AutoFindRequestEcho")){
            setAutoFindRequestEchoCache(rememberMeCookie);
        }
    }

    public String getRememberMe(EchoType echoType){
        if(echoType.getName().equals("SpringEcho1")){
            return getSpringEcho1Cache();
        }else if(echoType.getName().equals("SpringEcho2")){
            return getSpringEcho2Cache();
        }else if(echoType.getName().equals("TomcatEcho")){
            return getTomcatEchoCache();
        } else if(echoType.getName().equals("TomcatEcho2")){
            return getTomcatEcho2Cache();
        }else if(echoType.getName().equals("JBossEcho")){
            return getJBossEchoCache();
        }else if(echoType.getName().equals("WeblogicEcho")){
            return getWeblogicEchoCache();
        }else if(echoType.getName().equals("ResinEcho")){
            return getResinEchoCache();
        }else if(echoType.getName().equals("JettyEcho")){
            return getJettyEchoCache();
        }else if(echoType.getName().equals("AutoFindRequestEcho")){
            return getAutoFindRequestEchoCache();
        }

        return null;
    }


}
